#ifndef IMAGESTRUCTURE_H
#define IMAGESTRUCTURE_H

#include "BasicConfig.h"
#include "GhostFunction.h"

/* stream image datastream / SPics  file  BasicConfig.h */



static inline QPixmap RenderPixmapFromSvgBy(  QByteArray streams ) 
{
        QSvgRenderer  svgRenderer( streams );
        QPixmap pix(  svgRenderer.defaultSize() );
        pix.fill(Qt::transparent);
        QPainter paint(&pix);
        svgRenderer.render(&paint);
        return pix;
}






static inline QString ImageFilterHaving()
{
  QString filter;
  filter = QString( "All supported Types" ) + " (";
  QList<QByteArray> formats = QImageReader::supportedImageFormats();
  for ( int x = 0; x < formats.count(); ++x ) {

    filter += QString( "*.%1" ).arg( QString( formats[ x ] ) );
    if ( x != formats.count() - 1 )
      filter += " ";
  }
  filter += ");;";
  QString filterSimple;
  filterSimple += QString( "Scalable Vector Graphics" ) + " (*.svg *.svg.gz);;";
  if (getGSVersion() > 6) {
   filterSimple += QString( "PostScript Vector Graphics" ) + " (*.ps *.eps);;"; 
   filterSimple += QString( "PDF Page units" ) + " (*.pdf);;"; 
  }
  
  for ( int y = 0; y < formats.count(); ++y ) {

    QString form( formats[ y ] );
    if ( form == "bmp" )
      filterSimple += QString( "Windows Bitmap" ) + " (*.bmp)";
    else if ( form == "gif" )
      filterSimple += QString( "Graphic Interchange Format" ) + " (*.gif)";
    else if ( form == "jpeg" || form == "jpg" ) {

      if ( !filterSimple.contains( form ) )
        filterSimple += QString( "Joint Photographic Experts Group" ) + " (*.jpeg *.jpg)";
    } else if ( form == "mng" )
      filterSimple += QString( "Multiple-image Network Graphics" ) + " (*.mng)";
    else if ( form == "png" )
      filterSimple += QString( "Portable Network Graphics" ) + " (*.png)";
    else if ( form == "pbm" || form == "ppm" ) {

      if ( !filterSimple.contains( form ) )
        filterSimple += QString( "Portable Bitmap" ) + " (*.pbm *.ppm)";
    } else if ( form == "pgm" )
      filterSimple += QString( "Portable Graymap" ) + " (*.pgm)";
    else if ( form == "xbm" || form == "xpm" ) {

      if ( !filterSimple.contains( form ) )
        filterSimple += QString( "X11 Bitmap" ) + " (*.xbm *.xpm)";
    } else if ( form == "ico" )
      filterSimple += QString( "Icon Image File Format" ) + " (*.ico)";
    else if ( form == "jp2" || form == "j2k" ) {

      if ( !filterSimple.contains( form ) )
        filterSimple += QString( "JPEG 2000" ) + " (*.jp2 *.j2k)";
    } else if ( form == "tif" || form == "tiff" ) {

      if ( !filterSimple.contains( form ) )
        filterSimple += QString( "Tagged Image File Format" ) + " (*.tif *.tiff)";
    } else
      filterSimple += QString( "Unknown Format" ) + QString( " (*.%1)" ).arg( form );

    if ( y != formats.count() - 1 && !filterSimple.endsWith( ";;" ) )
      filterSimple += ";;";
  }
  
  
  
  
  filterSimple = filterSimple.left( filterSimple.length() - 2 );
  filter += filterSimple;

   return filter;

}





//
#endif // IMAGESTRUCTURE_H

